﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Data;
using System.Data.Objects.DataClasses;
using System.Linq;
using AppLab.Data.Models;
using AppLab.Web.Resources;
using Wicresoft.AppFlow.Flows;

namespace AppLab.Web
{
    public sealed partial class MobileType
    {
        [Key]
        public int MobileId { get; set; }

        public string TypeName { get; set; }

        /// <summary>
        /// whether there is the same MobileType
        /// </summary>
        /// <returns></returns>
        public bool Exist()
        {
            using (var dc = PMSEntities.Create())
            {

                bool bl = dc.MobileBasicInfoes.FirstOrDefault(p => p.MobileType == this.TypeName) != null;
                return bl;
            }
        }       
    }
}